/*
    www.cguage.com
    2.3 求前N位的质数
*/

#include <iostream>
#include <sstream>
#include <cassert>
#include <vector>
using namespace std;

#ifndef TEST
#define IN(iss) {                       \
        std::string str;                \
        std::getline(std::cin, str);    \
        iss.str(str);                   \
    }
#define OUT(s) std::cout << s
#endif

#define READ_N(iss, n) {    \
    iss >> n;               \
    iss.ignore(1, ',');     \
}

int main() {
    istringstream iss;
    IN(iss);
    assert(!iss.eof());
    int n = -1;
    iss >> n;
    assert(n > 1);

    vector<int> primeCache;
    if (n >= 2) {
        primeCache.push_back(2);
    }
    if (n >= 3) {
        primeCache.push_back(3);
    }
    if (n >= 5) {
        primeCache.push_back(5);
    }

    // 排除是2与3的倍数，则只有6n+1, 6n+5, 6n+7, 6n+11, ...
    // 满足从7开始, +2 OR +4 OR +2 ...即可

    int step = 2;
    for (int i = 7; i <= n; i += step) {

        // 测试是否是质数
        bool isPrime = true;
        for (auto iter = primeCache.begin(); iter != primeCache.end() && (*iter) * (*iter) < n; ++iter) {
            if (i % *iter == 0) {
                isPrime = false;
                break;
            }
        }

        if (isPrime) {
            primeCache.push_back(i);
        }
        step = 6 - step;
    }

    ostringstream oss;
    for (auto rstIter = primeCache.begin(); rstIter != primeCache.end() - 1; ++rstIter) {
        oss << *rstIter << " ";
    }
    oss << *(primeCache.end() - 1);
    OUT(oss.str());
    return 0;
}

#ifdef TEST
struct TestCase CASES[] = {
    /*0*/{"2", "2"},
    /*1*/{"10", "2 3 5 7"},
    /*2*/{"20", "2 3 5 7 11 13 17 19"},
    /*3*/{"24", "2 3 5 7 11 13 17 19 23"},
};
#endif